import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: HomeView,
      redirect: '/login',
      children: [
        { name: 'discovery', path: 'discovery', component: () => import('../views/DiscoveryView.vue') },
        { name: 'mylist', path: 'mylist', component: () => import('../views/MyPlaylist.vue') },
        { name: 'rec', path: 'rec', component: () => import('../views/RecView.vue') },
        { name: 'person', path: 'person', component: () => import('../views/PersonView.vue') },
        { name: 'search', path: 'search', component: () => import('../views/SearchView.vue') },
        { name: 'index', path: 'index', component: () => import('../views/NewSongView.vue') },
        { name: 'singer', path: 'singer', component: () => import('../views/SingerDetail.vue') },
      ]
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('../views/LoginView.vue')
    }
  ]
})

export default router
